<%@ page language="java" import="java.util.* ,java.net.URLEncoder, java.io.*" pageEncoding="UTF-8"%>
<%@ page import="javax.servlet.*,javax.servlet.http.*" %>


<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>先知的网站展示</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  
  <body> 
    欢迎来到本先知资源管理器<br>
  
   
  <jsp:useBean id="test" scope="page" class="testtool.Filemanage"/>
       
         <%         
         String path1=null;
         String webpath=null;
         String wp;
         if(request.getParameter("path1")!=null)
        { 
         path1=request.getParameter("path1");
         path1=new String(path1.getBytes("ISO-8859-1"),"UTF-8");//因为是从超连接传过来的参数 ，所以要转码。
         //得参数   否则取默认值
        }
          else 
         path1=request.getSession().getServletContext().getRealPath("/");
       
          if(request.getParameter("webpath")!=null)
           webpath=request.getParameter("webpath");
          else
          webpath=request.getContextPath();//得参数   否则取默认值
      
          out.println(webpath);
             request.setAttribute("path1", "XIAN戴维斯的吧个");       
         
            
        test.getNames(path1);//遍历文件并且赋值给Directory和filenames
        String []names=test.getDirectory();
         if(names!=null)
           for(String name:names)
           { 
             
             %>
             </br> <a href="index.jsp?webpath=<%=webpath+"/"+name%>&path1=<%=path1+"/"+name %>">   <%=name%></a></br></br>         
           <%      
           }
           
           names=test.getFilename();
           if(names!=null)
           for(String name:names){
          
            %>
           <a href="<%=webpath %>/<%=name %>"><%=name%></a></br></br>
           <%
     }
         %>
    
       
       
       
     
  
  </body>
</html>
